<extend name="Public/user"/>
<block name="link">
	<title>收货地址</title>
	<link href="/static/lida/css/tran_style.css" rel="stylesheet" type="text/css" />
	<link href="__CSS__/bootstrap.min.css" rel="stylesheet"/>
	<script src="__JS__/jquery.js"></script>
	<script src="__JS__/bootstrap.js"></script>
	<link href="__CSS__/shdz-style.css" rel="stylesheet"/>
	<script type="text/javascript" src="__STATIC__/thinkbox/thinkbox/jquery.thinkbox.js"></script>
	<script type="text/javascript" src="__JS__/style.js"></script>
	<link rel="stylesheet" type="text/css" href="__CSS__/common.css">

</block>
<block name="user-right">
	<style type="text/css">
		.address-form{
			position: absolute;
			width: 370px;
			padding: 20px;
			border: 1px solid red;
			top: -1px;
			left: -1px;
			background: #fff;
			min-height: 160px;
			display: none;
			z-index: 1000;
		}
		form{
			margin: 0;
			padding: 0;
			border: none;
			list-style-type: none;

		}
		.user-right .user-address .address-form input[type="text"]{
			width: 96%;
			padding: 2%;
			border: 1px solid #dfdfdf;
		}
		.blank{height: 10px;clear: both;}
		.btnqx{background: #fafafa;border: 1px solid #dfdfdf;width: 48%;padding: 5px 0;float: left;cursor: pointer;text-align: center;}
		.btnqd{background: #fafafa;border: 1px solid red;width: 48%;padding: 5px 0;float: right;background: red;color:#fff;cursor: pointer;text-align: center;}
	</style>

	<!--main_right-->
	<div class="main_r f_fr" style="height:100%;padding-bottom:80px;">
		<div class="user_kx">
			<h3 class="user_kx_title">
				收货地址管理

			</h3>
			<ul class="user-address">
				<li class="newadd" style="cursor: pointer;">
					<span  id="newadd">添加新地址</span>
					<div class="address-form">
						<!--<form method="post" action="{:url('')}">
							<input type="text" name="consignee"  value="{:lang('consignee')}" placeholder="{:lang('consignee')}">
							<div class="blank"></div>
							<input type="text" name="tel"  value="{:lang('mobile')}" placeholder="{:lang('mobile')}">
							<div class="blank"></div>
							<select name="areaid" style="width:100%;">
								<option value="0">{:lang('select_country')}</option>
								<volist name=":config('AREA_INFO')" id="v">
									<option value="{$key}">{$v}</option>
								</volist>
							</select>
							<div class="blank"></div>
							<input type="text" name="city"  value="省市" placeholder="省市">
							<textarea name="address" placeholder="{:lang('city_street')}" style="width: 96%;padding: 2%;"></textarea>
							<div class="blank"></div>
							<input type="text" name="zipcode" value="{:lang('zipcode')}" placeholder="{:lang('zipcode')}">
							<div class="blank"></div>
							<div style="">
								<button type="button" class="btnqx">{:lang('cancel')}</button>
								<button type="submit" class="btnqd">{:lang('confirm_address')}</button>
							</div>
						</form>-->
					<form method="post" action="{:url('')}" enctype="multipart/form-data">
						{:lang('consignee')}：<input type="text" name="consignee" value="" placeholder="">
						<div class="blank"></div>
						身份证号：<input type="text" name="idcard_no" value=""  style="width: 150px"placeholder="">
						<div class="blank"></div>
						身份证扫描件：<input type="file" name="idcard_file" style="width: 54%;display: inline;">
						<div class="blank"></div>
						{:lang('mobile')}：<input type="text" name="tel" value="" style="width: 120px" placeholder="">
						<div class="blank"></div>
						地址：<select name="areaid" style="width: 30%;">
							<!--<option value="0">{:lang('select_country')}</option>-->
							<volist name=":config('AREA_INFO')" id="v">
							<option value="{$key}">{$v}</option>
							</volist>
						</select>
						省市：<input type="text" name="city" style="width: 30%;" value=""
							placeholder="">
						<div></div>
						<textarea name="address" placeholder="{:lang('city_street')}"
							style="width: 96%; padding: 2%;"></textarea>
						<div class="blank"></div>
						{:lang('zipcode')}：<input type="text" name="zipcode" value=""
							style="width: 90px" placeholder="">
						<div class="blank"></div>
						<div style="">
							<button type="button" class="btnqx">{:lang('cancel')}</button>
							<button type="submit" class="btnqd">{:lang('confirm_address')}</button>
						</div>
					</form>
				</div>
				</li>
				<volist name="addresslist" id="v">
				<li class="addresslist">
					<span style="border-bottom: 1px solid #dfdfdf;display: block;padding-bottom: 5px;">{$v.consignee}</span>
					<div style="line-height: 25px; padding: 10px 0px;">
						{$v.tel} <br>{$v.areaname}&nbsp;&nbsp;{$v.city}  <br> {$v.address} ({$v.zipcode})
					</div>
					<div>
						<a href="javascript:;" class="btn btn-default address-edit">{:lang('edit')}</a>
						<a href="###" class="btn btn-default address-del" did="{$v.id}">{:lang('delete')}</a>
					</div>
					<div class="address-form">
						<form method="post" action="{:url('User/addressedit')}">
							<input type="text" name="consignee" value="{$v.consignee}"  placeholder="{:lang('consignee')}">
							<div class="blank"></div>
							<input type="text" name="tel" value="{$v.tel}" placeholder="{:lang('mobile')}">
							<div class="blank"></div>
							<select name="areaid" style="width:100%;">
								<option value="0">{:lang('select_country')}</option>
								<volist name=":config('AREA_INFO')" id="area">
									<option value="{$key}" <eq name="key" value="$v.areaid">selected</eq>>{$area}</option>
								</volist>

							</select>
							<div class="blank"></div>
							<input type="text" name="city"  placeholder="城市" value="{$v.city}" >
							<textarea name="address" placeholder="{:lang('city_street')}" style="width: 96%;padding: 2%;">{$v.address}</textarea>
							<div class="blank"></div>
							<input type="text" name="zipcode" value="{$v.zipcode}" placeholder="{:lang('zipcode')}">
							<div class="blank"></div>
							<div style="">
								<input type="hidden" name="id" value="{$v.id}">
								<button type="button" class="btnqx">{:lang('cancel')}</button>
								<button type="submit" class="btnqd">{:lang('confirm_address')}</button>
							</div>
						</form>
					</div>
				</li>
				</volist>

			</ul>
		</div>
	</div>
	<script type="text/javascript">
		$(function(){
			$('#newadd').click(function(){
				$(this).next().show();
			})
			$('.btnqx').click(function(){
				$(this).parents('.address-form').hide();
			})
			$('.address-edit').click(function(){
				$(this).parent().next().show();
			})
			$('.address-del').click(function(){
				var id=$(this).attr('did');
				if(confirm("{:lang('confirm_del_address')}")){
					$.post("{:url('User/addressdel')}",{'id':id},function(data){
						if (data.status) {
							$.thinkbox.success(data.info);
							setTimeout(jumpurl(data.url),1500);
						}else{
							$.thinkbox.error(data.info);
						};
					})
				}

			})
			/*$('form').submit(function(){
				var self = $(this);
				//$.post(self.attr("action"), self.serialize(), success, "json");
				return false;
				function success(data){
					if (data.status) {
						$.thinkbox.success(data.info);
						setTimeout(jumpurl(data.url),1500);
					}else{
						$.thinkbox.error(data.info);
					};
				}
			})*/
		})
	</script>
</block>